<?php
$cycles = $this->db->query_select("cllg_college_cycle");
?>
<script type="text/javascript">
     
     function getCursos (){
         $.ajax({
             type: "POST",
             url: "rpt_studCatedratico/getCatedratico.php?op=cursos",
             data: $("#reportform").serialize(),
             success: function (data){
                 $("#catInfo").html(data);
             }
         })
     }
     function getName(){
         $.ajax({
             type: "POST",
             url: "rpt_studCatedratico/getCatedratico.php?op=name",
             data: $("#reportform").serialize(),
             success: function (data){
                 $("#NOMBRE").html(data);
                 $("#CICLO").show();
             }
         })
     }
    </script>
<div id="getId">    
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <th colspan="2">
            <legend>Ingrese el ID o nombre del maestro y el ciclo</legend>
        </th>
        <tr>
            <td width="10%">ID CATEDRATICO O NOMBRE</td>
            <td width="90%">            
                <input name="ID" type="text" autocomplete="off" style='width:300px' data-provide='typeahead' data-source='<?php echo $this->getTypeaheadData("CONCAT(ID,' - ',FIRST_NAME,' ',LAST_NAME)","cllg_teacher"); ?>' onchange="getName();" id="ID"/>
        </tr>
        <tr id="CICLO">
            <td width="10%">CICLO</td>
            <td width="90%">
                <select name="CYCLE" type="text" onchange="getCursos();" id="CYCLE">
                    <option value="0">--Seleccione ciclo--</option>
                    <?php foreach ($cycles as $cy) { ?>
                            <option value="<?php echo $cy['CODE']; ?>"><?php echo $cy['CODE'];?></option>
                    <?php } ?>
                </select>
            </td>
        </tr>
    </table>
    <script>
        $("#CICLO").hide();
    </script>
</div>
<div id="catInfo"></div>
<br/>